//
//  CarSection.m
//  EJLX
//
//  Created by 徐绍明 on 15/12/5.
//  Copyright © 2015年 江苏一键联信息科技有限公司. All rights reserved.
//

#import "CarSection.h"

@implementation CarSection

+(CarSection *)praseWithDictionary:(NSDictionary *)dict{
    
    CarSection *car = [[CarSection alloc] init];
    
    if (![dict[@"groupId"] isKindOfClass:[NSNull class]]) {
     car.groupId = dict[@"groupId"];
    }else{
        car.groupId = @"";
        
    }
   if (![dict[@"shopId"] isKindOfClass:[NSNull class]]) {
        car.shopId = dict[@"shopId"];
    }else{
        car.shopId = @"";
        
    }
    if (![dict[@"shopName"] isEqual:[NSNull null]]) {
        car.shopName = dict[@"shopName"];
    }else{
        
        car.shopName = @"";
    }
    if (![dict[@"shopAvatar"] isEqual:[NSNull null]]) {
        car.shopImage = dict[@"shopAvatar"] ;
    }else{
        
        car.shopImage = @"";
    }
    if (![dict[@"shopAvatar"] isEqual:[NSNull null]]) {
        car.shopImage = dict[@"shopAvatar"] ;
    }else{
        
        car.shopImage = @"";
    }
    if (![dict[@"tip"] isEqual:[NSNull null]]) {
        car.shopTip = dict[@"tip"] ;
    }else{
        
        car.shopTip = @"";
    }
    
    
    NSArray *items = dict[@"itemList"];
    
    car.itemsArr = [NSMutableArray array];
    for (NSDictionary *item in items) {
        
        ShoppingCarItem *one = [ShoppingCarItem praseItemWithDictionary:item];
        
        [car.itemsArr addObject:one];
    }
    

       return car;
}

@end
